<?php

namespace App\Repositories\Config;


use App\Models\Config\Servers;
use App\Repositories\BaseRepository;

class ServersRepository extends BaseRepository
{
    public function __construct(Servers $model)
    {
        $this->model = $model;
    }

    //获取分页后的    所有服务器
    public function getPage($request)
    {

        if (!empty($request->get('game_id'))) {
            $this->where('game_id', $request->get('game_id'));
        }
        if (!empty($request->get('channel_id'))) {
            $this->where('channel_id', $request->get('channel_id'));
        }

        return $this->orderBy('game_id', 'ASC')
            ->orderBy('channel_id', 'ASC')
            ->orderBy('server_id', 'ASC')
            ->paginate($request->page_size);
    }


}